package duck;

/**
 * 测试类
 */
public class DuckTest {
    public static void main(String[] args) {
        System.out.println("=== 测试鸭子类体系 ===\n");

        System.out.println("1. 父类鸭子测试:");
        Duck duck = new Duck("灰色", 1.0);
        duck.display();
        duck.fly();
        duck.quack();
        duck.setHeavy(1.5);
        duck.display();

        System.out.println("\n2. 绿头鸭测试:");
        MallardDuck mallard = new MallardDuck();
        mallard.display();
        mallard.fly();
        mallard.quack();
        mallard.setHeavy(1.8);
        mallard.setHeavy(2);
        mallard.setHeavy("2.2");
        mallard.display();

        System.out.println("\n3. 北京鸭测试:");
        PekingDuck peking = new PekingDuck(3.0);
        peking.display();
        peking.fly();
        peking.quack();
        peking.setHeavy(2.8);
        double[] weights = {2.5, 3.0, 3.5};
        peking.setHeavy(weights);
        peking.setHeavy(2.0, 3.0);
        peking.display();

        System.out.println("\n4. 多态测试:");
        Duck duck1 = new MallardDuck();
        Duck duck2 = new PekingDuck();

        duck1.display();
        duck1.fly();
        duck1.quack();

        duck2.display();
        duck2.fly();
        duck2.quack();
    }
}